package play.control_flow

import kotlin.math.roundToInt

fun main() {
    for (i in 0..3) {
        print(i)
    }
    print(" ")

    for (i in 0 until 3) {
        print(i)
    }
    print(" ")

    for (i in 2..8 step 2) {
        print(i)
    }
    print(" ")

    for (i in 3 downTo 0) {
        print(i)
    }
    print(" ")

    for (c in 'a'..'d') {
        print(c)
    }
    print(" ")

    for (c in 'z' downTo 's' step 2) {
        print(c)
    }
    println()

    when (val x = Math.random().toInt()) {
        in 1..5 -> {
            print("x is in range from 1 to 5: $x")
        }
        in 6..10 -> {
            print("x is not in range from 6 to 10: $x")
        }
        else -> {
            println("x is over 10: $x")
        }
    }
}